<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      th:replace="fragments/layout(title='房间管理-编辑',jsPaths='/static/js/baseinfo/building/add.js')">
<div class="right" th:fragment="right">
    <!--面包屑-->
    <div class="breadcrumb layui-bg-gray">
                <span class="layui-breadcrumb" lay-separator=">">
                    <a th:href="@{/}">首页</a>
                      <a href="/organization">系统管理</a>
                    <a href="/room">房间管理</a>
                    <a><cite>编辑</cite></a>
                </span>
    </div>

    <!--主体内容区-->
    <div class="form-content layui-container">
        <form class="layui-form" th:action="@{/room/update}" method="post">
            <input type="hidden" name="id" th:value="${room.id}">
            <div class="layui-form-item">
                <label class="layui-form-label must">所属楼宇</label>
                <div class="layui-input-block">
                    <select name="buildingId" lay-verify="required">
                        <option value=""></option>
                        <option th:each="b:${buildings}" th:value="${b.id}" th:text="${b.name}" th:selected="${room.buildingId == b.id}"></option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label must">所属楼层</label>
                <div class="layui-input-block">
                    <input type="number" name="floor" th:value="${room.floor}"  oninput="if (value.length>4)value=value.slice(0,4)" lay-verify="required" placeholder="请输入所在层数" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">房间标签</label>
                <div class="layui-input-block">
                    <input type="text" name="tag" th:value="${room.tag}"   maxlength="50" placeholder="请输入标签(自定义的房间类型，如:普通房、四人间)" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">房间编号</label>
                <div class="layui-input-block">
                    <input type="text" name="code" th:value="${room.code}"   maxlength="10" placeholder="请输入房间编号,如：102" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-row">
                <div class="layui-col-md4">
                    <div class="layui-form-item">
                        <label class="layui-form-label">房间面积</label>
                        <div class="layui-input-inline">
                            <input type="number" name="area"  th:value="${room.area}"   oninput="if (value.length>4){value=value.slice(0,4)}else if (value.length==0){value=0} "  min="0"  placeholder="请输入房间面积" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-form-mid layui-word-aux">m<sup>2</sup></div>
                    </div>
                </div>
                <div class="layui-col-md4">
                    <div class="layui-form-item">
                        <label class="layui-form-label">房间朝向</label>
                        <div class="layui-input-inline">
                            <select name="direction">
                                <option value="0"></option>
                                <option value="1" th:selected="${room.direction ==1}">朝南</option>
                                <option value="2"  th:selected="${room.direction ==2}">朝北</option>
                                <option value="3"  th:selected="${room.direction ==3}">超西</option>
                                <option value="4"  th:selected="${room.direction ==4}">朝东</option>
                            </select>
                        </div>
                    </div>
                </div>
            </div>


            <div class="layui-form-item">
                <label class="layui-form-label must">是否可用</label>
                <div class="layui-input-block">
                    <select name="status" lay-verify="required">
                        <option value=""></option>
                        <option value="1"  th:selected="${room.status ==1}">是</option>
                        <option value="3"  th:selected="${room.status ==3}">否</option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn  layui-btn-normal" lay-submit lay-filter="submitBtn">保存</button>
                    <a href="/room" class="layui-btn layui-btn-primary">返回</a>
                </div>
            </div>
        </form>

    </div>
</div>
</html>